'use strict';

import React, { Component } from 'react';

import {
  StyleSheet,
  View,
} from 'react-native';

import TimerMixin from 'react-timer-mixin'
import ReactMixin from 'react-mixin'

import {NavigationBar} from 'react-native-navigator'
import QRCode from 'react-native-qrcode'

class QRCodeComponent extends Component {
  constructor(props) {
    super(props);
  
    this.state = {};
  }

  componentDidMount() {
    this.setInterval(()=> this.setState({}), 330);
  }

  render() {
    return (
      <View style={styles.container}>
        <NavigationBar navigator={this.props.navigator} title='QRCode'/>
        <QRCode style={styles.qrcode} source={`www.baidu.com?date=${new Date().getTime()}`}/>
      </View>
    );
  }
}

ReactMixin(QRCodeComponent.prototype, TimerMixin);

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#F5FCFF'
  },
  qrcode: {
    flex: 1,
    padding: 13
  }
});


export default QRCodeComponent;